# 导包
import unittest
import time
from script.test_login import TestLoginApi
from tools.HTMLTestRunner import HTMLTestRunner
import app

# 封装测试套件
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestLoginApi))
# 测试报告的路径 文件
report = app.base_dir+"/report/report-{}.html".format(time.strftime("%Y%m%d-%H%M%S"))
# 以文件流的形式打开文件
with open(report,"wb") as f:
    # 创建Htmltextrunner执行器
    runner = HTMLTestRunner(f,title="tpshop登录接口测试报告")
    # 执行测试套件
    runner.run(suite)